from django.utils.deprecation import MiddlewareMixin

class MyMiddleware(MiddlewareMixin):
    """docstrin
    g for MyMiddleware"""
    def process_request(self, request):
       print("md1  process_request 方法。", id(request)) #在视图之前执行
    def process_response(self, request, response):
        print(type(response))
        return response
